package com.ruoyi.web.controller.wexin;




import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.weixin.anno.ILog;
import com.ruoyi.weixin.anno.RequireLogin;
import com.ruoyi.weixin.entity.Picture;
import com.ruoyi.weixin.entity.Pictures;
import com.ruoyi.weixin.entity.R;
import com.ruoyi.weixin.service.PictureService;
import com.ruoyi.weixin.service.PicturesService;
import com.ruoyi.weixin.vo.PicsId;
import com.ruoyi.weixin.vo.TabName;
import com.ruoyi.weixin.vo.userId;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * (Pictures)表控制层
 *
 * @author makejava
 * @since 2023-12-26 09:51:50
 */

@RestController
@RequestMapping("/wexinLogin/pictures")
public class PicturesController  {
    /**
     * 服务对象
     */
    @Resource
    private PicturesService picturesService;

    @Resource
    PictureService pictureService;


    @PostMapping("selectHot")
    public R selectHot(@RequestBody Picture picture) {
        return R.ok(pictureService.selectHot(picture));
    }

    @PostMapping("findpicbytab")
    public R findpicbytab(@RequestBody TabName tabName) {
        System.err.println(tabName.getTabName());
        return R.ok(pictureService.findpicbytab(tabName));
    }


    @PostMapping("findSiPics")
    public R findGongPics(@RequestBody userId userid) {
        return R.ok(pictureService.findSiPics(userid));
    }

    @PostMapping("findGongPics")
    public R findSiPics(@RequestBody userId userid) {
        return R.ok(pictureService.findGongPics(userid));
    }

    @PostMapping("findLajiPics")
    public R findLajiPics(@RequestBody userId userid) {
        return R.ok(pictureService.findLajiPics(userid));
    }

    @PostMapping("findPicByPicsId")
    public R findPicByPicsId(@RequestBody PicsId picsId) {
        return R.ok(pictureService.findPicByPicsId(picsId));
    }


    @PostMapping("findPicByPicsIdAndtime")
    public R findPicByPicsIdAndtime(@RequestBody PicsId picsId) {
        return R.ok(pictureService.findPicByPicsIdAndtime(picsId));
    }

    @RequireLogin
    @PostMapping("newPics")
    public R newPics(@RequestBody Pictures pictures) {
        return R.ok(pictureService.newPics(pictures));
    }


    @ILog("上传相册图片")
    @PostMapping("uploadPic")
    public R uploadPic(MultipartFile file,String pid,String userId) {
        return R.ok(pictureService.uploadPic(file,pid,userId));
    }

    @ILog("上传动态图片")
    @PostMapping("uploadFrent")
    public R upload(MultipartFile file,String userId) {
        return pictureService.uploadFrent(file,userId);
    }


    @PostMapping("uploadAvator")
    public R uploadAvator(MultipartFile file,String userId) {
        return pictureService.uploadAvator(file,userId);
    }
}

